Skip to content
main
Switch branches/tags
jam0001/Boole/
jam0001/Boole/

Latest commit

* (no actual work!) claim crates.io names

* setup

* plane

* train

* idea

* Ast

* gitignore and lci

* merge vm start

* Update ast

* README

* add pub

* vm interface

* Start of parser working

* Regen cargo.lock

* Add station spacing script

* Move parser to seperate file

* Add some derives, create the do_current_step fn

It sort of works? Just need to figure out how to
actually update the locations of the trains but
i'm too tired so that'll have to happen tomorrow
i guess...

* Add name checking

* Add track checking

* Readable parse errors

* Improve parse errors

* Delete oude example

* frontend

* Add program parsing to main.rs

* Add vm

* update

* Fix compile

* Wishes parsing done

* Fibonacci versions

* Add tests for nearly every train method

* Add train routing script

* Add train routing script

* tiles

* Add operator icons

* New switch instructions

* Fix test

* new icons

* new icons

* tracks

* Implement vm again??

* add icon for delete op

* train count

* add extra train count test with delete

* part 1

* Switch empty operation

* Add empty switch

* add empty station test

* cli

* Trains did work, or not???

* suffering with trains and duplication

* Fibonacci complex working

* Make fib simple more immersive™️

* We are students, we don't use first class...

* support the british and their different spelling of colour, and the fact that white is not supported...

* Fix colors

* Print

* Print

* call python

* Add string printing

* Add test message, and allow program to complete when there are no more trains

* call python

* Add world to json writer

* web advance sim

* Fizzbuzz working!

* Remove hack

* Merge master

* add some stuff to readme

* initial visualization

* fix small things

* Rock paper scissors working!

* Improve cli

* moving trains

* add better intersections v1

* temp

* Show prints in UI

* add better intersections v2

* add better intersections v3

* temp

* T in different dirs

* Add a short story to the readme

* add better intersections (T-split)

* Fix running on windows?

* Clouds working

* Give trains a random id

* Fix self-loop stations

* input through web

* commit new things

* Add delete train function

* Fix tests after jona broke them

* Fix top-bar dragging

* Delete trains working

* Fix vm

* fix colors

* Add from

* slider

* Namen voor fizzbuzz

* Add **First class** **comments** to the readme

* Supress errors

* Add prints on screen

* Decorations

* Decorations

* Names for rock paper scissors

* Add basic decorations

* continue

* upadte readme

* Print python memory usage on linux, and print -1 on linux

* Water tiles

* Water tiles 2

* Increase memory limit

* carriages

* Make memory usage changable using envvar

* First class comments working

* First class comments working

* add carriage pictures

* Reduce frequency of comments

* Add more decorations

* Fix train lengths

* Different programs in README.md

* Add caching "compiled" station data

* Add screenshot to README.md

* colatz

* optimizations

* Add collatz

* First class passengers

* README.md

* add names

* fix compile instructions mistake

* Add syntax to readme

* Add syntax to readme

* video url

Co-authored-by: jonathan <jonathantbrouwer@gmail.com>
Co-authored-by: Julius de Jeu <julius@voidcorp.nl>
Co-authored-by: Noahiscool13 <n.j.m.jadoenathmisier@student.tudelft.nl>
Co-authored-by: Julius de Jeu <43351793+J00LZZ@users.noreply.github.com>
21acc69

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Aug 22, 2021
Aug 22, 2021
Aug 22, 2021
Aug 22, 2021
Aug 22, 2021
Aug 22, 2021
Aug 22, 2021
Aug 22, 2021
Aug 22, 2021
Aug 20, 2021

Train

Train is a totally not esoteric programming language to help you with doing computations while you're on your way home in a train. Train models computation as train networks with trains moving through it carrying two types of passengers. First class passengers who go to great lengths to describe the train they are in. Second class passengers just try to get where they want to go and carry some data with them.

For some examples, please refer to the shunting yard

Demo video:

https://youtu.be/x7GTFQAOMHI

Creators:

This is the submission of Team Boole:

Compilation instructions

cargo run -- shunting_yard/truth_machine.train

an optional argument (--cli / -c) can be added to run in headless mode.

This program uses python. By default, it calls the "python" executable, and expects at least python 3.8. However, if your operating system sucks and only provides python 2 for instance, or defaults to python 2 when python is called: set the "PYTHON_EXECUTABLE" environment variable to your preferred python executable that's at least python3.8.

In this python install, be sure to add the following libraries:

  • noise
  • matplotlib

Large programs

Large programs take a while to be layed out. They can also take a lot of memory to do so. While python runs, the memory usage is constantly printed, and when this value exceeds PYTHON_MEMLIMIT (in kilobytes) the process is restarted until it succeeds. For small maps, it may help to just restart (with cargo run -- programname) everything again until it succeeds.

When a map has succesfully been layed out, its layout is saved. If you want to regenerate this layout, supply the optional argument (--rebuild / -r).

LangJam

This programming language was written as a submission to the first LangJam in the weekend of saturday the 21st of august 2021 by Jonathan Brouwer, Jonathan Dönszelmann, Noah Jadoenathmisier, and Julius de Jeu.

Additional Documentation

Imagine you are a Dutch student. You don't live in the same city as where your university is, and thus must travel via train every morning. One morning before you board the train you get handed a card with the number 16 on it, but are not informed what that number means. You do however notice that you are the first person to board the train in second class. At the other side of the wall you can hear some people in first class commenting on the train, "What a nice lime green color this train has." Someone else responded "The yellow details are a nice addition as well yeah!" Confused you find a spot, and sit down.

At the first station, next to the name you see a big sign saying ADD underneath the station name. Suddenly a man runs at you from the train standing on track 2, he shouts: "Add 7 to your card! It's important!" Not knowing what is going on, you sheepishly add 7 to your number, and the train continues to the next station.

At the second station you again see a big sign underneath the station name, this one saying MUL. you hear a man shout at you to multiply your number by 3. Again, not really knowing why you do this, you multiply your number. The train departs again, not really knowing what to expect.

Just before you arrive at the station where you have to get off the train, you notice something. There is no one else in the train? How did you not see this before? "That's pretty weird" you say to yourself.

At your destination you again see a weird sign, this one saying PRINT NUMBER. When you get off the train, a woman walks up to you, and asks you what your number is. "69?" you say. Suddenly the woman shouts as loud as she can: "69!" Still not having any idea what this was about, you go on with your day.

First class passengers

While the second class passengers determine the data, first class passengers ("comments") influence the way the visualizer looks. They influence the color, length and accents of the train. Additionally, once every while the comment is shown as a message from the train.

Interesting Programs

  • incrementer.train outputs all numbers from 1 to infinity.
  • fibonacci_simple.train outputs all fibonacci numbers, using a very simple circuit.
  • fibonacci_complex.train outputs all fibonacci numbers, using a somewhat complex ciruit. This circuit looks quite nice, so this is the one we recommend running for testing.
  • rock_paper_scissors.train is possible but difficult to get running. It allows two players to play rock paper scissors, and the program will determine the winner.
  • fizzbuzz.train outputs all fizzbuzz values. It works in the CLI, but we have not gotten this running in the visualizer.
  • collatz.train takes a numbers as input, and outputs the numbers sequence to collatz sequence of the number
  • echo.train takes an input and outputs it immediately. Very simple, so useful for testing.

Syntax

The only constructs in this language are trains and stations. Trains carry data, while stations act as operations.

Stations

To create a station, use this syntax:

{name}
operation: duplicate
track 1: go to otherstation track 1
track 2: go to yetanotherstation track 1

The possible operations are:

  • Nothing Do nothing

Character manipulation

  • PrintString prints the current second class data as if it is a UTF-8 string.
  • PrintNumber prints the current second class data as raw numbers.
  • Input reads input, and stores it as bytes into the second class.

If statements

  • SwitchEqZero goes to track 1 if the train's current leading passenger has the value 0 attached to them, and picks track 2 otherwise.
  • SwitchGteZero goes to track 1 if passenger number 0 has a positive number attached to them.
  • SwitchEmpty if the train has no passengers, goes to track 1, and else track 2.

Train specific operators

  • Duplicate duplicates the train from track 1 to track 2.
  • Rotate rotates the first second class passenger to the back.
  • DeleteTop makes the first second class passenger exit the train at the current station.
  • Transfer transfers the first second class passenger of track 1 to the train in track 2.

Math operators These all work roughly the same, the value of track 2 is operator'd to the value of track 1.

  • Add does a +
  • Sub does a -
  • Mul does a *
  • Div does a /
  • Mod does a %

Delete

  • Delete removes the train from existence.

Trains

[LOCOMOTIVE]
start at station track 1
[FIRST CLASS]
jan: This is a nice red train
jonathan: And it is large!
[SECOND CLASS]
peet: 15
sam: 16

To use first class passengers, include one of these phrases in the sentence for the primary color:

  • {color} train
  • {color} color
  • {color} colour
  • {color} locomotive

For the secondary color:

  • {color} accents
  • {color} stripe
  • {color} line
  • {color} detail

The acceptable colors are:

  • light red
  • dark blue
  • dark red
  • light blue
  • dark green
  • light green
  • water blue
  • brown
  • yellow
  • orange

For the length:

  • long
  • big
  • medium
  • intermediate
  • normal
  • short
  • small
  • compact

The second class passengers just carry an integer as data.